﻿String.prototype.format = function () {
    var formatted = this;
    for (var i = 0; i < arguments.length; i++) {
        var regexp = new RegExp('\\{' + i + '\\}', 'gi');
        formatted = formatted.replace(regexp, arguments[i]);
    }
    return formatted;
};

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}

function daysFromNowToGMT(days) {
    var expireInDaysNumeric = -1;
    if (days.length != 0) {
        if (isNumber(days)) {
            expireInDaysNumeric = days;
        }
    }
    var fDaysFromNowToGmt = new Date();
    fDaysFromNowToGmt.setTime(fDaysFromNowToGmt.getTime() + (expireInDaysNumeric * 24 * 60 * 60 * 1000));
    return fDaysFromNowToGmt.toGMTString();
}
